<?php
$con = mysql_connect("localhost", "root", "");
if (!$con) {
    die('Could not connect: ' . mysql_error());
}

// Create table in my_db database
if (mysql_query("CREATE DATABASE my_db", $con)) {
    echo "Database created";
} else {
    echo "Error creating database: " . mysql_error();
};

mysql_select_db("my_db", $con);

$sql = "CREATE TABLE Admin 
(
AdminID int NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(AdminID),
UserName varchar(15),
Password varchar(255)
)";
mysql_query($sql, $con);

$sql = "CREATE TABLE Person 
(
PersonID int NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(PersonID),
UserName varchar(15),
Password varchar(255),
RealName varchar(15),
Phone varchar(255),
DrawPwd varchar(255),

Amount int,
Time datetime,
Ly varchar(255),
Checked int
)";
mysql_query($sql, $con);

$sql = "CREATE TABLE SiteConfig 
(
configID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(configID),
title varchar(255),
description varchar(255),
keyword varchar(255),
url varchar(255),
qq varchar(255),
purl varchar(255),
pid varchar(255),
pkey varchar(255)
)";
mysql_query($sql, $con);

$insql = "INSERT INTO `Admin`(`UserName`, `Password`) VALUES ('admin','admin');";
mysql_query($insql);
$insql = "INSERT INTO `SiteConfig`(`title`, `description`, `keyword`, `url`, `qq`, `purl`, `pid`, `pkey`) VALUES ('xx','xx','xx','xx','xx','xx','xx','xx');";
mysql_query($insql);

mysql_close($con);
?>